<template>
  <div>
    <!-- 备品备件领用 -->
    <div v-if="formKey==='spareApply'">
      <SpareConsumeApply v-if="!viewType" :task-id="taskId" :work-order-num="workOrderNum" v-on="$listeners" />
      <SpareConsumeApplyView v-else :task-id="taskId" :work-order-num="workOrderNum" v-on="$listeners" />
    </div>
    <div v-if="formKey=== 'spareGroupLeaderApprove'">
      <SpareConsumeGLeaderApprove v-if="!viewType" :task-id="taskId" :work-order-num="workOrderNum" v-on="$listeners" />
      <SpareConsumeGLeaderApproveView v-else :task-id="taskId" :work-order-num="workOrderNum" v-on="$listeners" />
    </div>
    <div v-if="formKey === 'sparePMApprove'">
      <SpareConsumePMApprove v-if="!viewType" :task-id="taskId" :work-order-num="workOrderNum" v-on="$listeners" />
      <SpareConsumePMApproveView v-else :task-id="taskId" :work-order-num="workOrderNum" v-on="$listeners" />
    </div>
    <div v-if="formKey === 'spareManagerConfirm'">
      <SpareConsumeConfirm v-if="!viewType" :task-id="taskId" :work-order-num="workOrderNum" v-on="$listeners" />
      <SpareConsumeConfirmView v-else :task-id="taskId" :work-order-num="workOrderNum" v-on="$listeners" />
    </div>
    <div v-if="formKey === 'spareManageCollect'">
      <SpareConsumeCollect v-if="!viewType" :task-id="taskId" :work-order-num="workOrderNum" v-on="$listeners" />
      <SpareConsumeCollectView v-else :task-id="taskId" :work-order-num="workOrderNum" v-on="$listeners" />
    </div>
  </div>
</template>

<script>

import forms from '../mixin/forms.js'

export default {
  name: 'NewOrderForm',
  // 混入所有表单
  mixins: [forms],
  props: {
    workOrderNum: {
      required: false,
      type: String,
      default: 'NULL'
    },
    formKey: {
      reuqired: true,
      type: String,
      default: ''
    },
    viewType: {
      required: false,
      type: Boolean,
      default: false
    },
    taskId: {
      required: false,
      type: String,
      default: 'NULL'
    }
  }
}
</script>
